#include <sys/types.h>
#include <sys/sem.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
  int semid;
  if (-1 == (semid = semget(IPC_PRIVATE, 3, 0777)))
  {
    perror("semget");
    exit(1);
  }
  system("ipcs -s");

  if (-1 == semctl(semid, 0, IPC_RMID))
  {
    perror("semctl");
    exit(1);
  }

  system("ipcs -s");


  
}
